<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" />
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<title></title>
	<style type="text/css">
		body{
			background-image:url(img/bb.jpg);
			background-repeat:repeat-x;
		}
	</style>
</head>
<body>
	<%@ include file="include/main-top.jsp" %>
	<div class="container well">
		<h2>新建目标</h2>
		<!-- 这是提交成功后,返回10000的话即提示成功 -->
		<c:if test="${param.state == '10000' }">
			<div id="addemp" class="alert alert-info fade in" >
	            <a href="#" data-dismiss="alert" class="close">×</a>
	            <strong>恭喜您,添加新目标成功!</strong>
	        </div>
		</c:if>
		<!-- 这是目标名称为空的话,即提示目标名称不能为空 -->
		<div id="msg" class="alert alert-error fade in" style="display:none" >
            <a href="#" data-dismiss="alert" class="close">×</a>
            <strong>error!目标名称不能为空!</strong>
        </div>
		<hr/>
		<form class="form-horizontal" action="addgoal.jspx" method="post">
			<fieldset>
				<div class="control-group">
		            <div class="controls">
						 <label><h3>目标名称</h3></label>
		                 <input type="text" id="gname" placeholder="--请输入目标名称--" class="span3" name="goalname">
		            </div>
		            <div class="controls">
						 <label><h3>目标描述</h3></label>
		                 <textarea rows="3" id="textarea" class="input-xlarge" name="goaldesc"></textarea>
		            </div>
		            <div class="controls">
						 <label><h3>选择负责人</h3></label>
		                 <select id="selectlevel" name="goalid">
		                 	<!-- 在此迭代的是雇员 -->
				             <c:forEach var="pel" items="${pelist}">
				            	<option value="${pel.id}"  > ${pel.username} </option>
				             </c:forEach>
			             </select>
		            </div>
		           <div class="form-actions">
		            <button class="btn btn-primary" id="addgoalbtn" type="submit" style="margin-left:200px">保存</button>
		            <a href="showgoal.jspx?projectid=${ep.project.id}" class="btn">返回</a>
		          </div>
		        </div>
	        </fieldset>
        </form>
	</div>
	<script type="text/javascript">
		$(document).ready(function(){
			$('#addgoalbtn').click(function(){
				if($('#gname').val() == "" || $('#gname').val() == null){
					$('#msg').show();
					$('#gname').focus();
					return false;
				}
			});
			$('#gname').keydown(function(){
				$('#msg').hide();
			});
		});
	</script>
</body>
</html>
